<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <h5>考前急训添加链接</h5>
  <input type="text" class="in">
  <button class="btn">添加</button>
  <h5>添加进群链接</h5>
  <input type="text" placeholder="exam_id" class="exam_id" style="width: 100px;">
  <input type="text" placeholder="进群地址" class="url">
  <button id="btn">添加</button>
  <script src="https://sfile.tl100.com/js/libs/axios.min.js"></script>
  <script>
    var api = axios.create({
      baseURL: 'https://api.tl100.com/exam_signup',
      withCredentials: true,
      timeout: 5000,
      headers: { 'Content-Type': 'application/json;charset=UTF-8' }
    });
    var btn =  document.querySelector('.btn');
    console.log(btn);
    btn.onclick = function () {
      var address = document.querySelector('.in').value;
      console.log(address);
      api.post('/api/data_lobo/setKqccVIPLink', {
        address: address
      }).then(function (res) {
        alert('添加成功')
      })
    }

    var btnObj = document.getElementById('btn');
    btnObj.onclick = function () {
      var exam_id = document.querySelector('.exam_id').value;
      var url = document.querySelector('.url').value;
      console.log(exam_id);
      console.log(url);
      api.post('/api/data_lobo/setKqccVIPLink', {
        exam_id,
        url
      }).then(function (res) {
        if(res.data.res_code ==1) {
          alert('添加成功')
        } else {
          alert('添加失败')
        }
      })
    }
  </script>
</body>

</html>